package pricingTag;

import java.util.*;

public class Deal {

	int count = 0;// the number of this deal has been considered; ++ when
					// generate reply
	Store from_store;
	Store to_store;
	LinkedList<Store> accepted_store; // the store that accept this deal
	LinkedList<Store> refused_store;// stores that refuse this deal
	String product_name;
	double increase_price;// how much do you want others to increase the price;
	double bonus; // how much is the bonus
	boolean from_store_accpet = true;
	boolean to_store_accpet = false;
	int time_length = 1;// default time length of this deal;

	public Deal(Store from_store, String product_name, double bonus,
			double increase_price) {
		this.from_store = from_store;
		this.bonus = bonus;
		this.product_name = product_name;
		this.increase_price = increase_price;
		accepted_store = new LinkedList<Store>();
		refused_store = new LinkedList<Store>();
		this.show();

	}

	public Deal(Store from_store, Store to_store, String product_name,
			double bonus, double increase_price) {
		this.to_store = to_store;
		this.from_store = from_store;
		this.bonus = bonus;
		this.product_name = product_name;
		this.increase_price = increase_price;
		accepted_store = new LinkedList<Store>();
		refused_store = new LinkedList<Store>();
		this.show();

	}

	void show() {
		System.out.println("------------------------------");
		System.out.println("Deal about \"" + this.product_name + "\" from "
				+ this.from_store);
		System.out.format("Asked increse price=%.2f and bonus=%.2f \n",
				this.increase_price, this.bonus);
		if (this.to_store_accpet) {
			System.out.println("Accepted by " + this.to_store.store_name);
			this.from_store.show_benefit_from_deal(this);
			this.to_store.show_benefit_from_deal(this);

		}
		// System.out.println();
		System.out.println("------------------------------");

	}

}
